package main

import "fmt"

func a(i ...int) {
	var t int
	for _, v := range i {
		t += v
	}
	fmt.Println(t)
}

func add(a, b int) {
	fmt.Println(a + b)
}

func callback(x int, f func(int, int)) {
	f(x, 3)
}

func bi() func(int2 int) int {
	x := 1
	return func(y int) int {
		return x + y
	}
}

func r() {
	err := recover()
	if err != nil {
		fmt.Println(err)
	}
}

func main() {

	defer r()

	panic("报错了")

	return
	a(1)

	f := bi()
	for i := 1; i < 5; i++ {
		fmt.Println(f(i))
	}
	f1 := bi()
	for i := 1; i < 5; i++ {
		fmt.Println(f1(i))
	}
	//localFunc := func(x, y int) {
	//	fmt.Printf("local func total %d\n", x-y)
	//}
	//callback(1, localFunc)
}
